
// // 使 Vue.observable 跳过 __unreactiveProperties 中定义的属性
// const _keys = Object.keys
// Object.keys = function (obj: any): string[] {
//     if(obj.__reactiveProperties) {
//         return obj.__reactiveProperties
//     }
//     if(obj.__unreactiveProperties) {
//         return _keys(obj).filter( (name:any)=> obj.__unreactiveProperties.indexOf(name)<0 )
//     }
//     return _keys(obj) 
// }

Array.prototype.removeFirst = function(item: any): any {
    var idx = this.indexOf(item) 
    if(idx > -1) {
        return this.splice(idx, 1) [0]
    }
}
Array.prototype.removeAll = function(item: any): void {
    for(var i=this.length; i>=0; i--) {
        if(this[i]==item) {
            this.splice(i, 1)
        }
    }
}

Number.prototype.equal = function(other : number): boolean  {
    return Math.abs(this- other)<Number.EPSILON
}

;(window as any).delay = function(ms: number){
    return new Promise(resolve=> setTimeout(resolve, ms) )
}


;(window as any).loop = function <T>(a: T[]): [T, number][] {
    return a.map((item, index) => ([ item, index ]));
}
